<?php

class controller_basic extends ujn_controller {

	var $auto_render = false;
	var $__params = array();
	
	protected function output($data) {
		$output = array();
		if(false !== $data) {
			$output = $data;
		}
		
		$out_json = json_encode($output);
		
		switch(isset($_REQUEST['jsonpcb'])) {
			case false:
				header('content-type: application/json; charset=utf-8');
				echo $out_json;
				break;
			case true:
				header('content-type: application/javascript; charset=utf-8');
				echo "{$_REQUEST['jsonpcb']}({$out_json})";
				break;
		}
	}

	function _before() {
		
//		$x = '{"sitemid":"698048618","time":"1300294465","key":"1d3d1930a0ad55a7788c43b6e422ce43","request_ids":["10150164537638619","10150164569068619","10150164588403619","10150164593228619"],"access_token":"129898123691203|2.6juAEbu4TawnPCCE8m0DsQ__.3600.1300298400-698048618|Udc_A-KOXoCpxiqIrylXF4zqDqQ","method":"user-dashboard","jsonpcb":"json_rpc_1300294493082"}';
//		$this->__params = json_decode($x, true);
		$this->__params = json_decode(stripslashes(urldecode($_REQUEST['json_values'])), true);
		// $this->__params = json_decode($_REQUEST, true);
		// $this->__params = json_decode(file_get_contents('php://input'), true);
		if(!is_array($this->__params)) $this->__params = array();
	}
	
	function index() {
		echo '? empty';
	}
}